<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/WipInventory/wipInventory" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="wipInventory" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >存货编码：</label>
            <input type="text" name="partName" value="${partName}" size="16" placeholder="存货编码"/>&nbsp;
            <label >内部图号：</label>
            <input type="text" name="group3" value="${group3}" size="16" placeholder="内部图号"/>&nbsp;
            <label >产品方向：</label>
            <g:select name="partDirection" from="${wipInventoryPartDirection}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="part_direction" optionValue="part_direction" value="${partDirection}" data-width="130"
                      noSelection="['':'-- All --']" />&nbsp;
            <label >时间段：</label>
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy/MM/dd" size="12" data-toggle="datepicker" placeholder="FROM">
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy/MM/dd" size="12" data-toggle="datepicker" placeholder="TO">
            <br /><br />
            <label >大组类：</label>
            <g:select name="totalGroup" from="${wipInventoryTotalGroup}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="total_group" optionValue="total_group" value="${totalGroup}" data-width="130"
                      noSelection="['':'ALL']" />&nbsp;
            <label >小分类：</label>
            <g:select name="detailCate" from="${wipInventoryDetailCate}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="detail_cate" optionValue="detail_cate" value="${detailCate}" data-width="130"
                      noSelection="['':'ALL']" />&nbsp;
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            %{--<button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/StageWip/exportExcel')" --}%
                    %{--data-icon="file-excel-o" title="导出Excel">导出</button>--}%
            <a type="button" class="btn btn-blue" href="${request.getContextPath()}/Base/exportExcel"
               data-toggle="doexport" data-confirm-msg="确定要导出吗？" data-icon="file-excel-o" title="导出Excel">导出</a>
        </div>
    </form>
</div>

<div class="bjui-pageContent tableContent">
    <g:if test="${wipInventory.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th ><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${wipInventory.size()>0}">
                <g:each in="${wipInventory}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='WIP_QTY'&&headInstance!='RN'}">
                                <td name="INVENTORYQTY${i}">${dataInstance["${headInstance}"]}</td>
                            </g:if>
                            <g:elseif test="${headInstance!='RN'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="7">小计</td>
                    <td name="inventoryShow"></td>
                </tr>
                <tr>
                    <td colspan="7">合计</td>
                    <td>${wipInventorySumQty.SUM_QTY[0]}</td>
                </tr>

            </g:if>
            </tbody>
        </table>
    </g:if>
    <g:else>
        <g:render template="../template/emptyPanel" />
    </g:else>
</div>
<g:render template="../template/pagination" />
<script>
    $(function(){
        var inventoryQty=0;
        for(var i=0;i<${wipInventory.size()};i++){
            var inventoryqty='INVENTORYQTY'+i
            var inventoryQtyAdd=$("td[name='"+inventoryqty+"']").text()==''?0:parseInt($("td[name='"+inventoryqty+"']").text())
            inventoryQty+=inventoryQtyAdd
        }
        $("td[name='inventoryShow']").html(inventoryQty)
    })
</script>